{% load formset_tags %} {% load i18n %}

<div class="formset" data-formset data-formset-prefix="{{ formset.prefix }}">
  {{ formset.management_form }} {{ formset.non_form_errors }}

  <div data-formset-body>
    {% for form in formset %}
      <div class="row formset-row" data-formset-form>
        <div class="sr-only">{{ form.id }} {{ form.DELETE}}</div>
        <div class="col-md-5">
          {{ form.non_field_errors }} {{ form.label.as_field_group }}
        </div>
        <div class="col-md-5">{{ form.url.as_field_group }}</div>
        <div class="col-md-2 text-right flip">
          <button type="button" class="btn btn-danger" data-formset-delete-button>
            <i class="fa fa-trash"></i>
          </button>
        </div>
      </div>
    {% endfor %}
  </div>

  <script type="form-template" data-formset-empty-form>
    {% escapescript %}
      <div class="row formset-row" data-formset-form>
      <div class="sr-only">
      {{ formset.empty_form.id }}
      {{ formset.empty_form.DELETE }}
      </div>
      <div class="col-md-5">
      {{ formset.empty_form.label.as_field_group }}
      </div>
      <div class="col-md-5">
      {{ formset.empty_form.url.as_field_group }}
      </div>
      <div class="col-md-2 text-right flip">

      <button type="button" class="btn btn-danger" data-formset-delete-button>
      <i class="fa fa-trash"></i></button>
      </div>
      </div>
    {% endescapescript %}
  </script>

  <p>
    <button type="button" class="btn btn-info" data-formset-add>
      <i class="fa fa-plus"></i> {% translate "Add link" %}
    </button>
  </p>
</div>
